<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('records', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id", 0, 1)->comment("用户id");
            $table->integer("task_id", 0, 1)->comment("任务id");
            $table->tinyInteger("status")->default("1")->comment("状态：1：成功，2：失败");
            $table->integer("action", 0, 1)->default("10")->comment("任务执行到的阶段");
            $table->text("command")->nullable()->comment("运行命令");
            $table->integer("duration")->nullable()->default("0")->comment("耗时，单位ms");
            $table->text("memo")->nullable()->comment("日志/备注");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('records');
    }
}
